program mynormal4, sortpreserve
	version 8.1
	if replay() {
		if (`"`e(cmd)'"' != "mynormal4") error 301
		Replay `0'
	}
	else	Estimate `0'
end

program Estimate, eclass
	syntax varlist [if] [in] [,		///
		noLOg				/// <- NEW
		noCONStant			/// <- NEW
		Robust				///
		CLuster(varname)		///
		HETero(varlist)			///
		Level(integer `c(level)')	/// -Replay- option
		*				/// <- NEW for -mlopts-
	]

	// check syntax
	mlopts mlopts, `options'			// <- NEW
	gettoken lhs rhs : varlist
	if "`cluster'" != "" {
		local clopt cluster(`cluster')
	}
	// mark the estimation sample
	marksample touse
	markout `touse' `hetero'
	markout `touse' `cluster', strok

	// fit the full model
	ml model d2 mynormal_d2				///
		(mu: `lhs' = `rhs', `constant')		/// <- CHANGED
		(lnsigma: `hetero')			///
		if `touse',				///
		`log'					/// <- NEW
		`mlopts'				/// <- NEW
		`robust'				///
		`clopt'					///
		missing					///
		maximize

	ereturn local cmd mynormal4

	Replay , level(`level')
end

program Replay
	syntax [, Level(integer `c(level)') ]
	ml display , level(`level')
end
